﻿using System;
using Besture.Bll;
using Besture.Common;

namespace Besture.UI.Admin.Control
{
    public partial class Sort : BaseControl
    {
        /// <summary>
        /// 表名
        /// </summary>
        public string Table { get; set; }

        public string SQL { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!EditPage)
                {
                    if (!string.IsNullOrEmpty(Table))
                    {
                        txtSortID.Text = SortService.GetSortID(Table, EditPage);
                    }
                    if (!string.IsNullOrEmpty(SQL))
                    {
                        txtSortID.Text = SortService.GetSortID(SQL, EditPage);
                    }

                }
            }
        }
        /// <summary>
        /// 排序值
        /// </summary>
        public int SortValue
        {
            get { return Convert.ToInt32(txtSortID.Text); }
            set { txtSortID.Text = value.ToString(); }
        }
    }
}